package at.fhj.itm11.forum.service.stubs;

import java.util.HashSet;
import java.util.Set;

import at.fhj.itm11.forum.data.UserDAO;
import at.fhj.itm11.forum.model.User;

public class UserDAOStub implements UserDAO {

	private Set<User> repo = new HashSet<User>();

	@Override
	public User findById(Long id) {
		for (User user : repo) {
			if (user.getId().equals(id)) {
				return user;
			}
		}

		return null;
	}

	@Override
	public User findByUsername(String username) {
		for (User user : repo) {
			if (user.getUsername().equals(username)) {
				return user;
			}
		}

		return null;
	}

	public Set<User> getRepo() {
		return repo;
	}

	public void setRepo(Set<User> repo) {
		this.repo = repo;
	}

}
